import SaveSceneExampleQueue from '../Utils.SaveSceneExampleQueue/UtilsSaveSceneExampleQueue';
import { UtilsLights, LightBody } from '../Utils.Lights/UtilsLights';
import Typed from '../../modules/typed/typed';

const _onKnapsack = Symbol('_onKnapsack');
const _onTyped = Symbol('_onTyped');
const _onLights = Symbol('_onLights');
const _onLightsBody = Symbol('_onLightsBody');
export class KnapsackShell {
    static [_onKnapsack]() {
        SaveSceneExampleQueue.getQueue().forEach(element => {
            if (element.SceneUiKnap) {
                // ajax get data...
                element.SceneUiKnap.onGetEquip([{key: 'clothingEquip'}, {key: 'helmetEquip'}]);
                element.SceneUiKnap.knapsack.setVisible(true);
                element.SceneUiKnap.knapClose.setVisible(true);
            }
        });
    }

    static init() {
        if (!KnapsackShell.instance) {
            KnapsackShell.instance = new KnapsackShell();
            KnapsackShell[_onKnapsack]();
        }
        return KnapsackShell.instance;
    }
}

export class TypedShell {
    static [_onTyped](_key, _that) {
        new Typed('#text', _that[_key]);
    }

    static init(_key, _that) {
        if (!TypedShell.instance) {
            TypedShell.instance = new TypedShell();
            TypedShell[_onTyped](_key, _that);
        }
        return TypedShell.instance;
    }
}

export class LightsShell {
    static [_onLights](_options, _that) {
        new UtilsLights(_options, _that);
    }

    static init(_options, _that) {
        if (!LightsShell.instance) {
            LightsShell.instance = new LightsShell();
            LightsShell[_onLights](_options, _that);
        }
        return LightsShell.instance;
    }
}

export class LightBodyShell {
    static [_onLightsBody](_data, _that) {
        new LightBody(_data, _that);
    }

    static init(_data, _that) {
        if (!LightBodyShell.instance) {
            LightBodyShell.instance = new LightBodyShell();
            LightBodyShell[_onLightsBody](_data, _that);
        }
        return LightBodyShell.instance;
    }
}